<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
		function loadScript	(url,callback,position) {
			var script = document.createElement('script');
			script.type = 'text/javascript';
			if (script.readyState) {//兼容ie
				script.onreadystatechange = function () {
					if(script.readyState == 'complete' || script.readyState == 'loaded') {
						callback();
					}
				}
			}else {
				script.onload = function () {
					callback();
				}
			}
			script.src = url;
			document[position].appendChild(script);//下载

		}

		loadScript('demo.js',function () {
			test();
		},'body')
	</script>
</body>
</html>